package com.ninong.ker.common.tools;

/**
 * 检查密码强度
 * 
 * @author cmd
 */
public class CheckPassword {

	/**
	 * 密码强度
	 * 
	 * @return Z = 字母 S = 数字 T = 特殊字符
	 */
	public static boolean checkPassword(String passwordStr) {
		String regexz = "\\d*";
		String regexs = "[a-zA-Z]+";
		String regext = "\\W+$";
		String regexzt = "\\D*";
		String regexst = "[\\d\\W]*";
		String regexzs = "\\w*";
		String regexzst = "[\\w\\W]*";
		int min = 6,max = 20;
		int len = passwordStr.length();
		if(len < min || len > max) {
			return false;
		}
		if (passwordStr.matches(regexz)) {
			return false;
		}
		if (passwordStr.matches(regexz)) {
			return false;
		}
		if (passwordStr.matches(regexs)) {
			return false;
		}
		if (passwordStr.matches(regext)) {
			return false;
		}
		if (passwordStr.matches(regexzt)) {
			return true;
		}
		if (passwordStr.matches(regexst)) {
			return true;
		}
		if (passwordStr.matches(regexzs)) {
			return true;
		}
		if (passwordStr.matches(regexzst)) {
			return true;
		}
		return false;
	}

}
